package com.mathlearning.auth.repository;

import com.mathlearning.auth.entity.CommentLike;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import java.util.Optional;

@Repository
public interface CommentLikeRepository extends JpaRepository<CommentLike, Long> {
    
    // 查找用户对某个评论的点赞记录
    Optional<CommentLike> findByCommentIdAndUserId(Long commentId, Long userId);
    
    // 判断用户是否点赞了某个评论
    boolean existsByCommentIdAndUserId(Long commentId, Long userId);
    
    // 删除用户对某个评论的点赞
    void deleteByCommentIdAndUserId(Long commentId, Long userId);
}








